package com.itheima.Test;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo服务器端01 {
    public static void main(String[] args) throws IOException {

            ServerSocket ss = new ServerSocket(9989);
            System.out.println(1);
            //获取客户端对象;
            Socket s = ss.accept();
            System.out.println(2);
            //创建输入流;
            InputStream is = s.getInputStream();
            byte[] arr  = new byte[1024];
            int i = is.read(arr);
            System.out.println("客户端对我说:"+new String(arr,0,i));
            s.close();


    }
}
